<!--  This file is part of Cobra.

    Cobra is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Cobra is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Cobra.  If not, see <http://www.gnu.org/licenses/>.

    http://code.google.com/p/cobra-extension/
    Igor Demyanov Igor.demyanov@gmail.com
    Dmitry Gribanov tux.spb@gmail.com
-->
<html>
<head>
<script language="JavaScript" type="text/javascript" src="sha-1.js"></script>
<script language="JavaScript" type="text/javascript" src="passhash-common.js"></script>
<script>
chrome.extension.onRequest.addListener(
	function(request, sender, sendResponse) {
		switch (request.action)
		{
		case "CalcPassword":
			var a = PassHashCommon.generateHashWord(
        	        request.tag,
        	        request.master,
        	        request.hashWordSize,
        	        true,
        	        true,
		 	true,
	                request.restrictSpecial,
                	false);
			sendResponse({content: a});
		break;
		case 'GetTemplate':
			sendResponse({content:templates[request.template]});
		break;
		default:
			sendResponse({error:{text:"Unknown error",code:1}});
		break;
		}
	});

var templates={
	options:'<input type="radio" name="PassLength" value="4" /> 4 '+
	'<input type="radio" name="PassLength" value="5" /> 5 <input type="radio" name="PassLength" value="6" /> 6 '+
	'<input type="radio" name="PassLength" value="8" checked /> 8 '+
	'<br><br><input type="checkbox" name="noSpecials"> No special symbols'
}
</script>
</head>
<body>
</body>
</html>
